<?php

class Backend_ErrorController extends Zend_Controller_Action
{

    public function errorAction()
	  {
	    // Ensure the default view suffix is used so we always return good
	    // content
	   // Set Zend View Interface
	   $this->_helper->viewRenderer->setViewSuffix('phtml');
	    // Grab the error object from the request
	    $errors = $this->_getParam('error_handler');
	
	    switch ($errors->type) {
	      case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
	      case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
	        // 404 error -- controller or action not found
	        $this->getResponse()->setHttpResponseCode(404);
	        $this->view->message = 'Page not found';
	        $this->view->code  = 404;
	        if ($errors->type == Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER) {
	          $this->view->info = sprintf(
	                      'Unable to find controller "%s" in module "%s"',
	                      $errors->request->getControllerName(),
	                      $errors->request->getModuleName()
	                    );
	        }
	        break;
	    }
	  }

}

